import styles from './styles.less';
import SearchForm from './components/SearchForm';
import DataTable from './components/DataTable';
import {useState} from 'react';
import DataForm from './components/DataForm';
import Salers from './components/salers/App';
import SalersSetting from './components/salersSetting/App';
import Users from './components/users/App';
import Orders from './components/orders/App';

const App = () => {

  const [tablePayload, setTablePayload] = useState({pageNum: 1, pageSize: 15, param: {}});
  const [dataForm, setDataForm] = useState(undefined);
  const [salers, setSalers] = useState(undefined);
  const [salersSetting, setSalersSetting] = useState(undefined);
  const [users, setUsers] = useState(undefined);
  const [orders, setOrders] = useState(undefined);

  return (
    <div className={styles.myContainer}>
      <DataForm data={{dataForm, setDataForm, tablePayload, setTablePayload}}/>
      <SearchForm data={{tablePayload, setTablePayload}}/>
      <DataTable data={{setOrders, setUsers, setSalersSetting, setSalers, setDataForm, tablePayload, setTablePayload}}/>
      <Salers data={{salers, setSalers}}/>
      <SalersSetting data={{salersSetting, setSalersSetting}}/>
      <Users data={{users, setUsers}}/>
      <Orders data={{orders, setOrders}}/>
    </div>
  );
};

export default App;
